1include <gridfinity-rebuilt-utility.scad>
  2
  3// ===== INFORMATION ===== //
  4/*
  5 IMPORTANT: rendering will be better for analyzing the model if fast-csg is enabled. As of writing, this feature is only available in the development builds and not the official release of OpenSCAD, but it makes rendering only take a couple seconds, even for comically large bins. Enable it in Edit > Preferences > Features > fast-csg
  6
  7https://github.com/kennetek/gridfinity-rebuilt-openscad
  8
  9*/
 10
 11// ===== PARAMETERS ===== //
 12
 13/* [Setup Parameters] */
 14$fa = 8;
 15$fs = 0.25;
 16
 17/* [General Settings] */
 18// number of bases along x-axis
 19gridx = 3;
 20// number of bases along y-axis
 21gridy = 3;
 22// bin height. See bin height information and "gridz_define" below.
 23gridz = 6;
 24
 25/* [Compartments] */
 26// number of X Divisions
 27divx = 2;
 28// number of y Divisions
 29divy = 2;
 30
 31/* [Toggles] */
 32// snap gridz height to nearest 7mm increment
 33enable_zsnap = false;
 34// how should the top lip act
 35style_lip = 0; //[0: Regular lip, 1:remove lip subtractively, 2: remove lip and retain height]
 36
 37/* [Other] */
 38// determine what the variable "gridz" applies to based on your use case
 39gridz_define = 0; // [0:gridz is the height of bins in units of 7mm increments - Zack's method,1:gridz is the internal height in millimeters, 2:gridz is the overall external height of the bin in millimeters]
 40// the type of tabs
 41style_tab = 1; //[0:Full,1:Auto,2:Left,3:Center,4:Right,5:None]
 42
 43/* [Base] */
 44style_hole = 0; // [0:no holes, 1:magnet holes only, 2: magnet and screw holes - no printable slit, 3: magnet and screw holes - printable slit]
 45// only cut magnet/screw holes at the corners of the bin to save uneccesary print time
 46only_corners = false;
 47// number of divisions per 1 unit of base along the X axis. (default 1, only use integers. 0 means automatically guess the right division)
 48div_base_x = 0;
 49// number of divisions per 1 unit of base along the Y axis. (default 1, only use integers. 0 means automatically guess the right division)
 50div_base_y = 0;
 51// thickness of bottom layer
 52bottom_layer = 1;
 53
 54
 55// ===== IMPLEMENTATION ===== //
 56
 57// ===== CONSTRUCTION ===== //
 58
 59module gridfinityLite(gridx, gridy, gridz, gridz_define, style_lip, enable_zsnap, length, div_base_x, div_base_y, style_hole, only_corners) {
 60    union() {
 61        difference() {
 62            union() {
 63                gridfinityInit(gridx, gridy, height(gridz, gridz_define, style_lip, enable_zsnap), 0, length, sl=style_lip)
 64                children();
 65                gridfinityBase(gridx, gridy, length, div_base_x, div_base_y, style_hole, only_corners=only_corners);
 66            }
 67
 68            difference() {
 69                union() {
 70                    intersection() {
 71                        difference() {
 72                            gridfinityBase(gridx, gridy, length, div_base_x, div_base_y, style_hole, -d_wall*2, false, only_corners=only_corners);
 73                            translate([-gridx*length/2,-gridy*length/2,2*h_base])
 74                            cube([gridx*length,gridy*length,1000]);
 75                        }
 76                        translate([0,0,-1])
 77                        rounded_rectangle(gridx*length-0.5005-d_wall*2, gridy*length-0.5005-d_wall*2, 1000, r_f2);
 78                        translate([0,0,bottom_layer])
 79                        rounded_rectangle(gridx*1000, gridy*1000, 1000, r_f2);
 80                    }
 81                    translate([0,0,h_base+d_clear])
 82                    rounded_rectangle(gridx*length-0.5005-d_wall*2, gridy*length-0.5005-d_wall*2, h_base, r_f2);
 83                }
 84
 85                translate([0,0,-4*h_base])
 86                gridfinityInit(gridx, gridy, height(20,0), 0, length, sl=style_lip)
 87                children();
 88            }
 89
 90        }
 91        difference() {
 92            translate([0,0,-1.6])
 93                difference() {
 94                    difference() {
 95                        union() {
 96
 97                            gridfinityInit(gridx, gridy, height(gridz, gridz_define, style_lip, enable_zsnap), 0, length, sl=style_lip)
 98                            children();
 99                        }
100
101                        difference() {
102
103                                intersection() {
104                                    difference() {
105                                        gridfinityBase(gridx, gridy, length, div_base_x, div_base_y, style_hole, -d_wall*2, false, only_corners=only_corners);
106                                        translate([-gridx*length/2,-gridy*length/2,2*h_base])
107                                        cube([gridx*length,gridy*length,1000]);
108                                    }
109                                    translate([0,0,-1])
110                                    rounded_rectangle(gridx*length-0.5005-d_wall*2, gridy*length-0.5005-d_wall*2, 1000, r_f2);
111                                    translate([0,0,bottom_layer])
112                                    rounded_rectangle(gridx*1000, gridy*1000, 1000, r_f2);
113                                }
114
115
116                            translate([0,0,-4*h_base])
117                            gridfinityInit(gridx, gridy, height(20,0), 0, length, sl=style_lip)
118                            children();
119                        }
120
121                    }
122                    translate([0,0,9])
123                    rounded_rectangle(gridx*1000, gridy*1000, gridz*1000, gridz);
124                }
125                    translate([0,0,0])
126                    rounded_rectangle(gridx*1000, gridy*1000, 5, r_f2);
127            }
128
129    }
130}